/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unioeste.cc.vm;

/**
 *
 * @author diego
 */
public class AluControl {

    int funct;
    int aluOp;
    int output;

    public int getAluOp() {
        return aluOp;
    }

    public void setAluOp(int aluOp) {
        this.aluOp = aluOp;
    }

    public int getFunct() {
        return funct;
    }

    public void setFunct(int funct) {
        this.funct = funct;
    }

    public int getOutput() {
        return output;
    }

    public void setOutput(int output) {
        this.output = output;
    }

    public void generateOutput() {
        switch (aluOp) {
            case 0: //load e store
                output = 2; //add
                break;
            case 1: //beq 
                output = 6; //sub
                break;
            case 2: //type-R
                switch (funct) {
                    case 32: //add
                        output = 2;
                        break;
                    case 34: //sub
                        output = 6;
                        break;
                    case 36: //and
                        output = 0;
                        break;
                    case 37: //or
                        output = 1;
                        break;
                    case 42: //slt
                        output = 7;
                    default:
                        break;
                }
        }
    }
}
